package stu.xjtu.physical.common.utls;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

import java.io.UnsupportedEncodingException;

@Slf4j
@Component
public class MD5encrypt {

    public  String encrypt3ToMD5(String str) {
        log.debug("MD5待加密字符串：\n"+str);
        String md5 = "  ";
        try {
            md5 = DigestUtils.md5DigestAsHex(str.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        log.debug("MD5加密结果：\n"+md5);
        return md5;
    }
}
